package com.yaorange.certificate.controller.wxapi;

import com.yaorange.certificate.service.CommonService;
import com.yaorange.common.core.controller.BaseController;
import com.yaorange.common.core.domain.AjaxResult;
import com.yaorange.common.core.domain.entity.SysDictData;
import com.yaorange.system.service.ISysDictDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
import org.springframework.web.multipart.MultipartFile;

import java.util.List;

/**
 * @author coach tam
 * @email 327395128@qq.com
 * @values 坚持灵活 灵活坚持
 * @since 2025/1/17
 */
@RestController
@RequestMapping("/api/common")
public class NjtCommonAPI extends BaseController {

    @Autowired
    private ISysDictDataService iSysDictDataService;
    @Autowired
    private CommonService comconService;

    @GetMapping("/queryDictType")
    public AjaxResult queryDictType(@RequestParam("dictType") String dictType) {
        List<SysDictData> list = iSysDictDataService.selectDictDataListByDictType(dictType);
        return AjaxResult.success(list);
    }

    @PostMapping("/upload")
    public AjaxResult upload(@RequestPart("file") MultipartFile multipartFile) {
        return AjaxResult.success(comconService.uploadFile(multipartFile));
    }
}
